package com.epam.lissina.collector;

import java.util.Iterator;
import java.util.List;

import com.epam.lissina.separator.TextSeparator;

public class Collect {

	public static String join(List<?> strings, String delimiter) {
		if (strings == null || strings.isEmpty())
			return TextSeparator.EMPTY_LINE;
		Iterator<?> iter = strings.iterator();
		StringBuilder builder = new StringBuilder(iter.next().toString());
		while (iter.hasNext()) {
			builder.append(delimiter).append(iter.next().toString());
		}
		return builder.toString();
	}
}
